<template>
  <div class="frame" style="padding: 0px">
      <div class="frame-header">
          <div class="text-content">
              <h1 class="title" style="height: 30px;">客户案例</h1>
              <h2 class="subtitle" style=" height: 150px;">分享客户在企业数字化转型与智能化升级过程中的实践与探索</h2>
          </div>
      </div>

      <div class="frame-case">
          <!--循环显示案例 网格布局-->
          <div class="cases-grid">
              <div v-for="caseItem in PaginationCases" :key="caseItem.id" class="case-item">
                  <!--图片-->
                  <div class="case-image-container">
                  <img :src="caseItem.image" alt="案例图片" class="case-image">
                  <div class="case-overlay">
                      <img :src="caseItem.icon" alt="案例图标"  class="case-icon">
                      <h3 class="case-overlay-title">{{ caseItem.title }}</h3>
                  </div>
                  </div>
                  <!--标题-->
                  <h3 class="case-title">{{ caseItem.title }}</h3>
                  <!--描述-->
                  <p class="case-description">{{ caseItem.description }}</p>
                  <!--按钮-->
                  <div class="case-buttons">
                      <button v-for="(button, index) in caseItem.buttons" :key="index" class="case-button">
                          {{ button }}
                      </button>
                  </div>

                  <!-- {{ caseItem.name }} -->
              </div>
          </div>

          <!--分页按钮-->
              <div class="pagination">
                  <button v-for="page in totalPages":key="page" @click="showPage(page)" :class="{ active: currentPage === page }">
                  {{ page }}</button>
              </div>
      </div>

      <div class="frame-knowmore">
          <h1 class="consult-title" style="height: 30px;">一键咨询，了解更多行业案例</h1>
              <div class="industries">
                  <span>银行、证券、法属</span>
                  <span>法律公司、初创企业</span>
                  <span>政务、司法、公安</span>
                  <span>医疗、教育、电商</span>
              </div>
      </div>

      <!-- <div class="frame-footer">
          <h1 class="explore">立即探索，解锁更多产品详情</h1>
          <button class="btn-consult">方案咨询</button>
          <el-button type="primary" class="consult-button" @click="openForm">申请试用</el-button>
      </div> -->

      <div class="frame-footer">
                <h1 class="expore-text">立即探索，解锁更多产品详情</h1>
                <button class="btn-consult" type="primary" @click="openForm">申请使用 ></button>

                    <!-- 表单对话框 -->
  <el-dialog title="申请试用" :visible.sync="dialogVisible" width="600px" @close="resetForm">
    <el-form ref="form" :model="form" label-width="80px" class="form-container">
      <el-form-item label="姓名">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="职业">
        <el-select v-model="form.region" placeholder="请选择活动区域">
          <el-option label="法律相关领域" value="law"></el-option>
          <el-option label="教育相关领域" value="education"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="出生日期">
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
        </el-col>
       
      </el-form-item>
      <el-form-item label="使用性质">
        <el-radio-group v-model="form.resource">
          <el-radio label="商用"></el-radio>
          <el-radio label="个人使用"></el-radio>
                      <el-radio label="政府单位使用"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="申请说明">
        <el-input type="textarea" v-model="form.desc"></el-input>
      </el-form-item>

      <!-- 按钮组 -->
      <el-form-item class="button-group">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="dialogVisible = false">取消</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
            </div>

  </div>
</template>

<script>
export default {
    name: "customerCase",
    data() {
        return {
          cases:[
              {   id: 1, 
                  name: "案例1", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_1@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 2, 
                  name: "案例2", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_2@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 3, 
                  name: "案例3", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_3@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 4, 
                  name: "案例1", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_4@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 5, 
                  name: "案例5", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_5@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 6, 
                  name: "案例6", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_1@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 7, 
                  name: "案例7", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_1@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 8, 
                  name: "案例8", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_1@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },
              {   id: 9, 
                  name: "案例9", 
                  title: "贵州省人民政府政务服务中心",
                  description: "以商业大数据赋能科技公司，助力实施全流程周期管理", 
                  image: require('@/assets/images/case/sence_1@2x.jpg'),
                  icon: require('@/assets/images/case/XIAN_U.svg'),
                  buttons:["关于我们","政府服务","数字赋能"]
              },

          ], // 每页显示的案例数量
          currentPage: 1,// 当前页码
          casesPerPage: 6,// 每页显示的案例数量
          dialogVisible: false, // 控制对话框的显示与隐藏
          form: {
              name: '',
              region: '',
              date1: '',
              date2: '',
              delivery: false,
              type: [],
              resource: '',
              desc: ''
      }
        };
    },
    computed: {
      totalPages() {
          return Math.ceil(this.cases.length / this.casesPerPage);
  },
      PaginationCases() {
          const start = (this.currentPage - 1) * this.casesPerPage;
          const end = start + this.casesPerPage;
          return this.cases.slice(start, end);
  },
},
methods: {
  showPage(page) {
    this.currentPage = page;
      },
  openForm() {
    this.dialogVisible = true; // 打开对话框
  },
  submitForm() {
    this.$refs.form.validate((valid) => {
      if (valid) {
        this.$message.success('申请已提交！');
        this.dialogVisible = false;
        this.resetForm();
      } else {
        this.$message.error('请完整填写表单！');
        return false;
      }
    });
  },
  resetForm() {
    this.$refs.form.resetFields(); // 重置表单内容
  }    
  }
};
</script>

<style scoped lang="scss">
//   .icon-svg {
//       width: 20px; /* 调整宽度 */
//       height: 20px; /* 调整高度 */
//   }

.frame-header {
  background: url('../../assets/images/solution/popularSceneBg.png') no-repeat center center;/* 背景图 */
  background-size: cover;/* 使背景图始终覆盖整个容器 */
  height: 520px;
}

.text-content {
  display: flex;
  flex-direction: column;// 使子元素垂直排列
  align-self: flex-start;// 使子元素靠左对齐
  position: relative;
  padding-left: 200px;
  padding-top: 160px;
}

.title {
  color: #000;
  font-size: 60px;
  font-weight: bold;
  margin: 0;// 去除默认的外边距
  line-height: 70px;// 设置行高
  padding-bottom: 50px;// 设置底部内边距
  width: 550px;
}

.subtitle {
  color: rgb(47, 107, 236);
  font-size: 30px;
  font-weight: bold;
  line-height: 100px;
  padding-bottom: 30px;// 设置底部内边距
}

.frame-case {
.cases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 15PX;
  // height: 400px;
  gap: 20px;
  margin-top: 20px;
}

.case-item {
  background: #fff;
  border: 1px solid #ddd;
  // border-radius: 8px;
  // padding: 15px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s,box-shadow 0.3s;
  overflow: hidden;

  &:hover {
      transform: translateY(-5px);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  //   transform: scale(1.05);
  }

  .case-image-container {
      position: relative;
      width: 100%;
      height: 150px;
      overflow: hidden;
  }

  .case-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
  //   border-radius: 8px;
  }

  .case-overlay {
      position: relative;
      bottom: 0;
      width: 100%;
      background-color: rgba(255, 255, 255, 0.8);/* 设置背景颜色为白色，透明度为0.8 */
      padding: 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
  }

  .case-icon{
      width: 40px;
      height: 40px;
      margin-bottom: 5px;
  }

  .case-overlay-title {
      font-size: 16px;
      font-weight: bold;
      color:#333;
      text-align: center;
  }

  .case-title {
    font-size: 20px;
    font-weight: bold;
    margin: 10px 0;
  }

  .case-description {
    font-size: 16px;
    color: #555;
    margin: 0 15px 10px;
  }

  .case-buttons {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-bottom: 15px;

      .case-button{
      padding: 5px 10px;
      border: 1px solid #007bff;
      background-color: #fff;
      color: #007bff;
      font-size: 14px;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.3s, color 0.3s;

      &:hover {
        background-color: #007bff;
        color: #fff;
      }
  }
  }
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 20px;

  button {
    margin: 0 5px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;

    &.active {
      background-color: #007bff;
      color: #fff;
    }
  }
}
}

.frame-knowmore {
  background-image: url('~@/assets/images/solution/advantage_Bg.png');
  width: 100%;
  height: 200px; /* 设置高度 */
  margin: 0 auto;
  padding: 20px;
  text-align: left;
  position: relative;
  padding-left: 200px;
}

.consult-title {
  color: #fff;
  padding: 20px;
  margin-bottom: 40px;
  font-size: 30px;
}

.industries {
  display: flex;
  flex-wrap: wrap;// 使子元素换行
  align-items: center;
  gap: 30px;
}

.industries span {
  color: #fff;
  display: inline-flex;
  align-items: center;
  position: relative;
  padding-left: 15px;
  margin: 10px;
  font-size: 20px;
}

.industries span::before {
  content: "|"; /* 添加竖线 */
  position: absolute;// 设置绝对定位
  left: 0;
  color: #fff;
  font-size: 25px;// 设置竖线大小
}



.frame-footer {
  background-color: #f7faff;
  height: 130px;
  padding-left: 200px;
}

.expore-text {
  color: cornflowerblue;
  font-size: 25px;
  // padding: 20px;
  // margin-bottom: 100px; /* 设置底部外边距 */
}



.btn-consult {
background-color: #007bff;
color: white;
padding: 10px 20px;// 调整按钮内边距
font-size: 1.2rem;
border: none;// 去掉边框
border-radius: 8px;//添加圆角边框
cursor: pointer;//鼠标悬停时显示手型
margin-top: 15px;//调整按钮上边距
transition: background-color 0.3s;//添加背景颜色过渡效果
}

.btn-consult:hover {
background-color: #0056b3;
}

</style>